package com.sx.gongzhong.pest;

import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.ApiManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.view.IVoidView;

import java.util.Map;

/**删除
 * Created by admin on 2018/1/12.
 */

public class DeletePest {
    public IVoidView booleanView;

    public DeletePest(IVoidView booleanView) {
        this.booleanView = booleanView;
    }

    //评论 删除
    public void deleteCommon(String url, String id){
        Map<String,Object> map= HeadParamBean.getHead();
        map.put("id",id);
        new ApiManager().deleteCommon(url,map, new BaseCallBack<ReplyUserBean.BaseResult<Boolean>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<Boolean> response) {
                booleanView.voidView("删除成功");
            }

            @Override
            public void onFailures(String message) {
                booleanView.showError(message);
            }
        });
    }

    //我的 帖子 删除
    public void deleteMyAdd(String url, String id){
        Map<String,Object> map= HeadParamBean.getHead();
        map.put("ids",id);
        new ApiManager().deleteCommon(url,map, new BaseCallBack<ReplyUserBean.BaseResult<Boolean>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<Boolean> response) {
                booleanView.voidView("删除成功");
            }

            @Override
            public void onFailures(String message) {
                booleanView.showError(message);
            }
        });
    }
}
